using System;
using UnityEngine;
using UnityEngine.UI;
public class BuildingPlacementManagerUI_Button : MonoBehaviour
{
    [SerializeField] private Image iconImage;
    [SerializeField] private Image selectImage;
    [SerializeField] private Button button;

    private BuildingTypeSO buildingTypeSO;

    public void Setup(BuildingTypeSO buildingTypeSO)
    {
        this.buildingTypeSO = buildingTypeSO;
        iconImage.sprite = buildingTypeSO.sprite;
        button.onClick.AddListener(OnButtonClickHandler);
    }

    private void OnButtonClickHandler()
    {
        BuildingPlacementManager.Instance.SetActiveBuildingTypeSO(buildingTypeSO);
    }

    public void ShowSelected()
    {
        selectImage.enabled =true;
    }

    public void HideSelected()
    {
        selectImage.enabled = false;
    }
}
